(ns com.yawmark.euler.clj.e38
    (:use com.yawmark.euler.clj.core))

(defn pandigital-9? [digits]
  (n-pandigital? 9 (as-digits digits)))

(defn multiply-and-concat [num upto]
  (apply str (map #(* num %) (range 1 (inc upto)))))

(defn euler-38 []
  (reduce max (for [  a (range 1 10000)
                      b (range 2 10)
                      c [(multiply-and-concat a b)]
                      :when (= 9 (count c))
                      :when (pandigital-9? c)]
                   (as-int c))))


